{% extends 'base.html' %}
{% block title %}  - Upload attachments {% endblock %}
{% block content %}

<script>
	function check_video(img_form){
		var desc = img_form.desc.value.length;
		if (desc > 299){
			alert("Description is longer than 300 characters!");
			img_form.desc.focus();
			return false;
		}

		var location = img_form.video.value;
		if (location == ""){
			alert("Please chose a video!");
			return false;
		}		

		return true;
	}
</script>

<div id="content" style="position:absolute; top:20px; left:0px; background-color: #1A1A1A; layer-background-color: #1A1A1A;"> 
	
		<table width="610">
        <tr>
<td colspan="2"><p><span style="font-size:14px;color:#CCC">Upload Attachment</span></p></td>
        <form enctype="multipart/form-data" method="post" action="/user/attachment/" onsubmit="return check_video(this);">
        	<tr>
				<td><b>Title:</b></td><td><input type="text" name="title" id="title" size="25"><br />
                Max 30 characters.
                </td>
			</tr>
			<tr>
				<td><b>Description:</b></td><td><textarea name="desc" id="desc" rows="4" cols="40"></textarea><br />
                Max 300 characters.
                </td>
			</tr>
	
			<tr>
				<td><b>Chose file:</b></td><td><input type="file" name="file" id="file"></td>
			</tr>
			<tr>
				<td></td><td><input type="submit" value="Upload">
				</td>
			</tr>
            </form>
            <tr><td colspan="'2">
            <FORM><INPUT TYPE=button VALUE="Back" onclick=window.history.back()></FORM>
            </tr></td>
		</table>	
</div>

{% endblock %}